using MicroMsg.Common.Utils;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
namespace MicroMsg.Storage
{
	public class TloAppInfo : TloXmlItem
	{
		public string strID;
		public int nVersion;
		public string strAppName;
		public string strInstallUrl;
		public string strFromUrl;
		public TloAppInfo()
		{
		}
		public TloAppInfo(XElement xelement_0)
		{
			this.parse(xelement_0);
		}
		public bool parse(XElement xelement_0)
		{
			using (IEnumerator<XElement> enumerator = xelement_0.Elements().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					XElement current = enumerator.get_Current();
					if (!current.get_IsEmpty() || current.get_HasAttributes())
					{
						if (current.get_Name() == "id")
						{
							this.strID = (string)current;
						}
						else
						{
							if (current.get_Name() == "version")
							{
								this.nVersion = (int)current;
							}
							else
							{
								if (current.get_Name() == "appName")
								{
									this.strAppName = (string)current;
								}
								else
								{
									if (current.get_Name() == "installUrl")
									{
										this.strInstallUrl = (string)current;
									}
									else
									{
										if (current.get_Name() == "fromUrl")
										{
											this.strFromUrl = (string)current;
										}
										else
										{
											Log.smethod_4("TimeLineObject", "unknown AppInfo tag=" + current.get_Name());
										}
									}
								}
							}
						}
					}
				}
			}
			return true;
		}
		public XElement toXElement()
		{
			XElement xElement = new XElement("appInfo");
			xElement.Add(new XElement("id", this.strID));
			xElement.Add(new XElement("version", this.nVersion));
			xElement.Add(new XElement("appName", this.strAppName));
			xElement.Add(new XElement("installUrl", this.strInstallUrl));
			xElement.Add(new XElement("fromUrl", this.strFromUrl));
			return xElement;
		}
	}
}
